import axios from '@/utils/request'
//登录
export const LoginAsync = (params) => {
  return axios.post('/lanlu/user/login', params)
}

//退出登录
export const LogoutAsync = (params) => {
  return axios.post("/lanlu/user/logout", params)
}

//获取个人信息
export const getUserInfoAysnc = (params) => {
  const { id } = params
  return axios.get(`/lanlu/user/goUpdateUserPage?id=${id}`)
}

//更新个人信息
export const updateUserInfoAsync = (params) => {
  return axios.post('/lanlu/user/update', params)
}

//更新头像
export const updateAvatarAsync = (params) => {
  return axios({
    method: 'POST',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: params,
    url: '/lanlu/upload',
  })
}

//注册
export const registerUserAsync = (params) => {
  return axios.post('/lanlu/user/register', params)
}

//修改密码 
export const updatePasswordAysnc = (params) => {
  return axios.post('/lanlu/user/editPassWord', params)
}

//发送短信
// type   1表示忘记密码 ， 2表示注册用
export const sendMessageAsync = (params) => {
  const { phone, type } = params
  return axios.get(`/lanlu/sms/sendPhone?phone=${phone}&type=${type}`)
}

//忘记密码 修改密码
export const updatePasswordByPhoneAysnc = (params) => {
  return axios.post('/lanlu/user/editPassWordByPhone', params)
}
